/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import entity.User;
import java.util.ArrayList;

/**
 *
 * @author NgocNam
 */
public class managerUser {
     ArrayList<User> list;

    public managerUser() {
        list = new ArrayList<User>();
    }

    public void addUser(User u) {
        list.add(u);
    }

    public void addUser(ArrayList<User> list) {
        this.list.addAll(list);
    }

    public void removeUser(User u) {
        this.list.remove(u);
    }
   

    public void updateUser(User u) {
        for (int i = 0; i < this.list.size(); i++) {
            if (list.get(i).getUserName() == u.getUserName()) {
                list.set(i, u);
            }
        }

    }

    public User getUser(int index) {
       return  this.list.get(index);
    }

    public int getSize() {
        return list.size();
    }
}
